# -*- coding: utf-8 -*-
import paramiko

if __name__ == "__main__":
    hostname = '10.20.0.254'
    port = 22
    username = 'root'
    password = '123456'
    cmd = "cd /opt/app/mysql_3306"

    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect(hostname, username=username, password=password, allow_agent=False, look_for_keys=False)
    stdin, stdout, stderr = ssh.exec_command(cmd)
    stderr_list = stderr.readlines()
    stdout_list = stdout.readlines()
    print(stdout_list)
    print(stderr_list)

    ssh.close()